<?php
/**
 * Core_Data_Basicxssfilter
 * basic xss filter
 *
 * @author Adrian Stolarski
 */
class Core_Data_Basicxssfilter implements Core_Data_Xssfilterable {
    
    /**
     * xss_filter()
     * basic xss filter
     * 
     * @param type $value
     * @return type $value
     */
    public function xss_filter($value) {
        $value = htmlspecialchars($value, ENT_QUOTES);
        $value = str_replace(array('&amp;','&lt;','&gt;'), array('&amp;amp;','&amp;lt;','&amp;gt;'), $value);
        $value = preg_replace('/(&#*w+)[x00-x20]+;/u', '$1;', $value);
        $value = preg_replace('/(&#x*[0-9A-F]+);*/iu', '$1;', $value);
        return $value;
    }

}
